package cn.intotw.rdcj.user.consumer;



import cn.intotw.rdcj.core.constant.topic.MqConstant;
import cn.intotw.rdcj.user.bean.UserVo;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Chenxiang
 * @Description:
 * @create 2020/4/14 20:32
 */
@Service
@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = MqConstant.TOPIC.RDCJ_USER_GROUP)
@Slf4j
public class UserConsumer implements RocketMQListener<UserVo> {
    @Autowired
    Gson gson;
    @Override
    public void onMessage(UserVo userVo) {
        log.info(gson.toJson(userVo));
    }
}